package easy;

public class Solution_551 {

    public boolean checkRecord(String s) {
        int countA = 0, countL = 0;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            switch (c) {
                case 'A':
                    countA++;
                    countL = 0;
                    if (countA > 1) {
                        return false;
                    }
                    break;
                case 'L':
                    countL++;
                    if (countL > 2) {
                        return false;
                    }
                    break;
                default:
                    countL = 0;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Solution_551 model = new Solution_551();
        System.out.println(model.checkRecord("PPALLP"));
        System.out.println(model.checkRecord("PPALLL"));
    }
}
